package br.com.threads;
/**
 * Demonstra o metodo yield como uma forma de priorizar um thread.
 * @author sidney.ferreira
 *
 */
public class Programa12 implements Runnable {
	public void run(){
		for (int i = 0; i <= 4; i++)
			System.out.println(Thread.currentThread().getName());
	}
	
	public static void main(String[] args) {
		Programa12 p = new Programa12();
		Thread t1 = new Thread(p);
		Thread t2 = new Thread(p);
		Thread t3 = new Thread(p);
		t1.start();
		t2.start();
		t3.start();
		
		t1.setPriority(10);
		t2.setPriority(10);
		t3.setPriority(Thread.NORM_PRIORITY);
		Thread.yield();
	}
}
